import { defHttp } from '@/utils/http/axios'

enum Api {
  ADD_DEVICE_TYPE = '/device/type/add',
  UPDATE_DEVICE_TYPE = '/device/type/update',
  DELETE_DEVICE_TYPE = '/device/type/delete',
  DEVICE_TYPE_LIST = '/device/type/list',
  ADD_DEVICE = '/device/manage/add',
  UPDATE_DEVICE = '/device/manage/update',
  DELETE_DEVICE = '/device/manage/delete',
  ADD_DEVCIE_BASE = '/device/manage/addBase',
  DEVICE_DETAIL = '/device/manage/detail',
  DEVICE_TREE = '/device/manage/tree',
  DEVICE_PAGE = '/device/manage/page',
  DEVICE_LIST = '/device/manage/list',
  DEVICE_DATATYPE_LIST = '/device/type/property/dataTypeList',
  DEVICE_PROPERTY_DATA_TYPELIST = '/device/property/dataTypeList',
  DEVICE_MEASURE_RECORD_PAGE = '/device/collector/measure/record/page',
  DEVICE_ALARM_RECORD_PAGE = '/device/collector/alarm/record/page',
  DEVICE_PROPERTY_LIST = '/device/collector/device/property/list',
  DEVICE_ALARM_LIST = '/device/collector/device/alarm/list',
  DEVICE_ALARM_ADD = '/device/collector/device/alarm/add',
  DELETE_DEVCIE_ALARM = '/device/collector/device/alarm/delete',
  DEVICE_BIND_PARAMS = '/device/collector/device/property/save',
  DELETE_DEVICE_BIND_PARAMS = '/device/collector/device/property/delete',
  CHECK_DEVICE_BIND_PARAMS = '/device/collector/device/property/deleteCheckById',
  // 设备通道
  DEVICE_CHANNEL_LIST = '/device/collector/channel/list',

}

export const addDeviceType = (data) => defHttp.post({ url: Api.ADD_DEVICE_TYPE, data })
export const deleteDeviceAlarm = (data) => defHttp.post({ url: Api.DELETE_DEVCIE_ALARM, data })
export const addDeviceAlarm = (data) => defHttp.post({ url: Api.DEVICE_ALARM_ADD, data })
export const updateDeviceType = (data) => defHttp.post({ url: Api.UPDATE_DEVICE_TYPE, data })
export const deleteDeviceType = (data) => defHttp.post({ url: Api.DELETE_DEVICE_TYPE, data })
export const getDeviceTypeList = (params) => defHttp.get({ url: Api.DEVICE_TYPE_LIST, params })
export const addDevice = (data) => defHttp.post({ url: Api.ADD_DEVICE, data })
export const updateDevice = (data) => defHttp.post({ url: Api.UPDATE_DEVICE, data })
export const deleteDevice = (data) => defHttp.post({ url: Api.DELETE_DEVICE, data })
export const addDeviceBase = (data) => defHttp.post({ url: Api.ADD_DEVCIE_BASE, data })
export const deviceBindParams = (data) => defHttp.post({ url: Api.DEVICE_BIND_PARAMS, data })
export const deleteDeviceBindParams = (data) => defHttp.post({ url: Api.DELETE_DEVICE_BIND_PARAMS, data })
export const checkDeviceBindParams = (data) => defHttp.post({ url: Api.CHECK_DEVICE_BIND_PARAMS, data })
export const getDeviceDetail = (params) => defHttp.get({ url: Api.DEVICE_DETAIL, params })
export const getDevicePage = (params) => defHttp.get({ url: Api.DEVICE_PAGE, params })
export const getDeviceList = (params) => defHttp.get({ url: Api.DEVICE_LIST, params })
export const getDeviceTree = (params) => defHttp.get({ url: Api.DEVICE_TREE, params })
export const getDeviceDataTypeList = (params) =>
  defHttp.get({ url: Api.DEVICE_DATATYPE_LIST, params })
export const getDevicePropertyDataTypeList = (params) =>
  defHttp.get({ url: Api.DEVICE_PROPERTY_DATA_TYPELIST, params })
export const getDeviceMeasureRecordPage = (params) =>
  defHttp.get({ url: Api.DEVICE_MEASURE_RECORD_PAGE, params })
export const getDeviceAlarmRecordPage = (params) =>
  defHttp.get({ url: Api.DEVICE_ALARM_RECORD_PAGE, params })
export const getDevicePropertyList = (params) =>
  defHttp.get({ url: Api.DEVICE_PROPERTY_LIST, params })
export const getDeviceAlarmList = (params) => defHttp.get({ url: Api.DEVICE_ALARM_LIST, params })
export const getDeviceChannelList = () => defHttp.get({ url: Api.DEVICE_CHANNEL_LIST })
